#include <stdio.h>
#include <stdlib.h>
void InputScore(int *p,int m,int n)
{
    int i,j;
    for(i=0;i<m;i++)
    {
        printf("please input No.%d class's score\n",i+1);
        for(j=0;j<n;j++)
        {
            printf("please input the score of No.%d student:",j+1);
            scanf("%d",p+i*n+j);
        }
    }
}
int FindBest(int *p,int m,int n,int *pcla,int *pstu)
{
    int i;
    int cla,stu;
    int best=*(p);
    for(i=1;i<m*n;i++)
    {
        if(best<*(p+i))
        {
            best=*(p+i);
            stu=i%n;
            cla=(i-stu)/n;
        }
    }
    *(pcla)=cla+1;
    *(pstu)=stu+1;
    return best;
}
void main()
{
    int n,m,best;
    int a=0,b=0;
    int *score;
    int *pcla=&a;
    int *pstu=&b;
    printf("please input how many class:");
    scanf("%d",&m);
    printf("please input how many student in each class:");
    scanf("%d",&n);
    score=(int *)calloc(m*n,sizeof(int));
    InputScore(score,m,n);
    best=FindBest(score,m,n,pcla,pstu);
    printf("the student who gets the highest mask is No.%d student in No.%d class,and the score is %d",*(pstu),*(pcla),best);
    free(score);
}
